<!--
 * @Author: Islands 1430536748@qq.com
 * @Date: 2024-07-14 20:03:23
 * @LastEditors: 周洋 1430536748@qq.com
 * @LastEditTime: 2024-08-10 00:22:20
 * @version: 1.2.0
 * @Description: 登陆表单
-->
<script setup lang="ts">
import type { TabsPaneContext } from "element-plus";
import { LoginWayEnum } from '@/enum/index';
import { $t } from '@/plugins/index';
import PwdLogin from './modules/password.vue';
import CodeLogin from './modules/code.vue';
import ThirdLogin from './modules/Third.vue';
const activeName = ref(LoginWayEnum.PASSWORD);
const pwdRef = ref<any>(null);
const codeRef = ref<any>(null);
const handleClick = (pane: TabsPaneContext, _ev: Event) => {
    pane.props.name === LoginWayEnum.PASSWORD ?
        pwdRef.value.resetForm() :
        codeRef.value.resetForm();
};
const Constant = computed(() => {
    return {
        password: $t(`login.pwdLogin`),
        code: $t(`login.codeLogin`)
    };
});
</script>
<template>
    <div class="box" style="padding: 20px 15px">
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane :label="Constant.password" :name="LoginWayEnum.PASSWORD">
                <PwdLogin ref="pwdRef" />
            </el-tab-pane>
            <el-tab-pane :label="Constant.code" :name="LoginWayEnum.CODE">
                <CodeLogin ref="codeRef" />
            </el-tab-pane>
        </el-tabs>
        <ThirdLogin />
    </div>
</template>